package com.beemans.common.app.ui.fragments

import android.view.View
import com.beemans.common.app.R
import com.beemans.common.app.databinding.FragmentStickyChildBinding
import com.beemans.common.app.ui.adapters.StickyAdapter
import com.beemans.common.app.ui.base.BaseFragment
import com.beemans.common.ext.init
import com.tiamosu.databinding.delegate.lazyDataBindingOrNull
import com.tiamosu.databinding.page.DataBindingConfig

/**
 * @author tiamosu
 * @date 2021/9/1.
 */
class StickyChildFragment : BaseFragment() {
    private val dataBinding: FragmentStickyChildBinding? by lazyDataBindingOrNull { }
    private val adapter: StickyAdapter by lazy { StickyAdapter() }

    override fun getDataBindingConfig(): DataBindingConfig {
        return DataBindingConfig(R.layout.fragment_sticky_child)
    }

    override fun initView(rootView: View?) {
        dataBinding?.stickyChildRv?.init(
            bindAdapter = adapter
        )
    }

    override fun onFlyLazyInitView() {
        super.onFlyLazyInitView()
        mutableListOf<String>().apply {
            for (i in 0..50) {
                add("(*´▽｀)ノノ:$i")
            }
        }.let(adapter::setList)
    }

    override fun doBusiness() {
    }
}